Attribute VB_Name = "modProcessCommand"
Public Sub processCommand(ByVal text As String)
  
  If Not Left(text, 1) = "/" Then Exit Sub
  If Len(text) <= 1 Then Exit Sub

  cmd = Split(Mid(LCase(text), 2), " ")
  ucmd = UBound(cmd)

  Select Case cmd(0)
  
    Case "?", "help"
                AddChat vbRed, ">> Normal Commands"
                AddChat vbWhite, "-- ", vbLightTeal, "/w [Username] [Your Message]", vbBrown, " :: Send a whisper to a user."
                AddChat vbWhite, "-- ", vbLightTeal, "/r, reply [Your message]", vbBrown, " :: Whisper the last person that whispered you."
                AddChat vbWhite, "-- ", vbLightTeal, "/j [Channel Name]", vbBrown, " :: To join a new Channel."
                AddChat vbWhite, "-- ", vbLightTeal, "/rj, rejoin", vbBrown, " :: Makes you rejoin the current channel."
                AddChat vbWhite, "-- ", vbLightTeal, "/ver", vbBrown, " :: Reveals the current version of VectorNet Bot."
                AddChat vbWhite, "-- ", vbLightTeal, "/online, users, stats", vbBrown, " :: Returns the statistics of VectorNet."
                AddChat vbWhite, "-- ", vbLightTeal, "/idle on/off", vbBrown, " :: Turns the idle messages on/off"
                AddChat vbWhite, "-- ", vbLightTeal, "/greet on/off", vbBrown, " :: Turns the greet messages on/off"
                AddChat vbWhite, "-- ", vbLightTeal, "/h, home", vbBrown, " :: If you do not have a home channel set, this will take you to Main."
                AddChat vbWhite, "-- ", vbLightTeal, "/ut, uptime", vbBrown, " :: Tells you connection information about your computer."
                AddChat vbWhite, "-- ", vbLightTeal, "/trig, trigger", vbBrown, " :: Reveals your currently set trigger."
                AddChat vbRed, ">> Special Commands"
                AddChat vbWhite, "-- ", vbLightTeal, "//ver", vbBrown, " :: Sends your VectorNet Bot version to the server for all to see."
                AddChat vbWhite, "-- ", vbLightTeal, "//ut, uptime", vbBrown, " :: Sends your connection information to the server for all to see."
                AddChat vbRed, ">> Admin / Moderator Commands"
                AddChat vbWhite, "-- ", vbLightTeal, "/kick", vbBrown, " :: Gives you the ability to kick a user."
                AddChat vbWhite, "-- ", vbLightTeal, "/ban", vbBrown, " :: Gives you the ability to ban a user."
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 18
                
    Case "w", "whisper", "whisp"
                If frmChat.sckVectorNet.State <> sckConnected Then Exit Sub
                If ucmd <= 1 Then Exit Sub

                whispMessage = Right(text, Len(text) - (Len(cmd(0) & " " & cmd(1) & " ") + 1))
                whisperTo = cmd(1)
                sendPacket &H12, vbNullString
                requestType = "whisper"
                
    Case "v", "version", "ver"
                
                    ver = "Using :: VectorNet Bot v2.4 by Plugins ::"
                
                    AddChat vbCyan, "<" & username & "> ", vbGreen, ver
                    frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                    
                
    Case "j", "join"
                If frmChat.sckVectorNet.State = sckConnected Then
                     sendPacket &HC, username & Chr$(0) & Split(text, cmd(0) & " ")(1)
                   Else
                     AddChat vbGray, "-- ", vbYellow, "You must be connected to do that!"
                     frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                End If
                                
    Case "h", "home"
              If frmChat.sckVectorNet.State = sckConnected Then
                If frmConfig.txtHome.text <> vbNullString Then
                    sendPacket &HC, username & Chr$(0) & frmConfig.txtHome
                Else
                    AddChat vbRed, "No home channel set.. Joining Default VectorNet Channel!"
                    frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                    sendPacket &HC, username & Chr$(0) & "Main"
                End If
               End If
    
    Case "stats", "users", "online"
                    sendPacket &H11, vbNullString
                    
    Case "kick", "ban"
                    sendPacket &H2, username & Chr$(0) & text
    
    Case "idle"
                    Select Case cmd(1)
                      Case "on"
                            frmChat.tmrIdle.Enabled = True
                              frmConfig.txtIdle.Enabled = True
                                frmConfig.txtIdleTime.Enabled = True
                                  frmConfig.chkIdle.Value = 1
                             AddChat vbGray, "Idle messages enabled!"
                             frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                             
                      Case "off"
                            frmChat.tmrIdle.Enabled = False
                              frmConfig.txtIdle.Enabled = False
                                frmConfig.txtIdleTime.Enabled = False
                                  frmConfig.chkIdle.Value = 0
                            AddChat vbGray, "Idle messages disabled!"
                            frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                            
                End Select
                    
    Case "greet"
                    Select Case cmd(1)
                      Case "on"
                            frmConfig.txtGreet.Enabled = True
                            frmConfig.chkGreet.Value = 1
                            AddChat vbGray, "Greet messages enabled!"
                            frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                            
                      Case "off"
                            frmConfig.txtGreet.Enabled = False
                            frmConfig.chkGreet.Value = 0
                            AddChat vbGray, "Greet messages disabled!"
                            frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                            
                    End Select
                    
    Case "ut", "uptime"
                takeOffBias = GetTickCount() \ 1000
                
                clientUTGet = GetTickCount() - clientUptime
                takeOffCTBias = clientUTGet \ 1000
                
                sDays = takeOffBias \ 24 \ 60 \ 60
                sHours = (takeOffBias \ 60 \ 60) Mod 24
                sMinutes = (takeOffBias \ 60) Mod 60
                sSeconds = takeOffBias Mod 60
                
                cDays = takeOffCTBias \ 24 \ 60 \ 60
                cHours = (takeOffCTBias \ 60 \ 60) Mod 24
                cMinutes = (takeOffCTBias \ 60) Mod 60
                cSeconds = takeOffCTBias Mod 60
                  
                AddChat vbCyan, "<" & username & "> ", vbWhite, "Computer uptime: " & sDays & " days, " & sHours & " hours, " & sMinutes & " minutes, " & sSeconds & " seconds."
                AddChat vbCyan, "<" & username & "> ", vbWhite, "Connection uptime: " & cDays & " days, " & cHours & " hours, " & cMinutes & " minutes, " & cSeconds & " seconds."
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 2
                
                prepString = "Computer uptime: " & sDays & " days, " & sHours & " hours, " & sMinutes & " minutes and " & sSeconds & " seconds. "
                cUTString = "Connection uptime: " & cDays & " days, " & cHours & " hours, " & cMinutes & " minutes and " & cSeconds & " seconds."

    Case "userinfo"
    
                Select Case cmd(1)
                    Case "me"
                            AddChat vbYellow, "Username: ", vbGray, frmProfile.lblUsername.Caption, vbYellow, " Age: ", vbGray, frmProfile.txtAge
                            frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                End Select
                
    'Case "con", "connect"
                'Call frmChat.Connect
                
    'Case "disc", "disconnect"
                'Call frmChat.Disc
                
    Case "rj", "rejoin"
                sendPacket &HC, username & Chr$(0) & currentChannel

    Case "trig", "trigger"
                AddChat vbTeal, "The bot's current trigger is: " & frmConfig.txtTrigger.text
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                
    Case "whoami"
                AddChat vbBrown, "You are the bot console!"
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                
    Case "pingme"
                AddChat vbGray, "Your ping at logon is " & resultingPing & "ms"
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                
    Case "sethome"
                homeChan = Split(text, cmd(0) & " ")(1)
                
                frmConfig.txtHome.text = homeChan
                AddChat vbGray, "-- Home Channel is now: ", vbGreen, homeChan
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1

    Case "setusername"
                NewUsername = Split(text, cmd(0) & " ")(1)
                
                frmConfig.txtUsername.text = NewUsername
                AddChat vbGray, "-- Username is now: ", vbGreen, NewUsername
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
    
    Case "botstats"
    
                MFO = "Messages From Others: " & frmStatus.txtMsgCount.Caption
                MFY = "Messages From You: " & frmStatus.txtSentCount.Caption
                WFO = "Whispers From Others: " & frmStatus.txtWhispRecv.Caption
                WFY = "Whispers From You: " & frmStatus.txtWhispered.Caption
                MWA = "Main Window AddChat: " & frmStatus.txtMainWindowAddChat.Caption
                
                AddChat vbGray, "-- Messages From Others: ", vbYellow, frmStatus.txtMsgCount.Caption
                AddChat vbGray, "-- Messages From You: ", vbYellow, frmStatus.txtSentCount.Caption
                AddChat vbGray, "-- Whispers From Others: ", vbYellow, frmStatus.txtWhispRecv.Caption
                AddChat vbGray, "-- Whispers From You: ", vbYellow, frmStatus.txtWhispered.Caption
                AddChat vbGray, "-- Main Window Addchat: ", vbYellow, frmStatus.txtMainWindowAddChat.Caption
                
                sendPacket &H2, username & Chr$(0) & MFO
                sendPacket &H2, username & Chr$(0) & MFY
                sendPacket &H2, username & Chr$(0) & WFO
                sendPacket &H2, username & Chr$(0) & WFY
                sendPacket &H2, username & Chr$(0) & MWA
                
    Case "setserver"
                newServer = Split(text, cmd(0) & " ")(1)
                
                frmConfig.txtServer.text = newServer
                AddChat vbGray, "-- Server set to: ", vbGreen, newServer
                frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
    
    Case Else
                If frmChat.sckVectorNet.State <> sckConnected Then Exit Sub
                sendPacket &H2, username & Chr$(0) & text
                
    End Select
    
        If Not Left(text, 2) = "//" Then Exit Sub
  If Len(text) <= 2 Then Exit Sub

  cmd1 = Split(Mid(LCase(text), 3), " ")
  ucmd2 = UBound(cmd1)
    
    Select Case cmd1(0)
    Case "v", "version", "ver"
                
                ver = "Using :: VectorNet Bot v2.4 by Plugins ::"
                
                If frmChat.sckVectorNet.State = sckConnected Then
                    sendPacket &H2, username & Chr$(0) & ver
                    AddChat vbCyan, "<" & username & "> ", vbGreen, ver
                    frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                  Else
                    AddChat vbGray, "-- ", vbYellow, "You must be connected to do that!"
                    frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                End If
                
    Case "ut", "uptime"
                takeOffBias = GetTickCount() \ 1000
                
                clientUTGet = GetTickCount() - clientUptime
                takeOffCTBias = clientUTGet \ 1000
                
                sDays = takeOffBias \ 24 \ 60 \ 60
                sHours = (takeOffBias \ 60 \ 60) Mod 24
                sMinutes = (takeOffBias \ 60) Mod 60
                sSeconds = takeOffBias Mod 60
                
                cDays = takeOffCTBias \ 24 \ 60 \ 60
                cHours = (takeOffCTBias \ 60 \ 60) Mod 24
                cMinutes = (takeOffCTBias \ 60) Mod 60
                cSeconds = takeOffCTBias Mod 60
                
             If frmChat.sckVectorNet.State = sckConnected Then
                   AddChat vbCyan, "<" & username & "> ", vbWhite, "Computer uptime: " & sDays & " days, " & sHours & " hours, " & sMinutes & " minutes, " & sSeconds & " seconds."
                   AddChat vbCyan, "<" & username & "> ", vbWhite, "Connection uptime: " & cDays & " days, " & cHours & " hours, " & cMinutes & " minutes, " & cSeconds & " seconds."
                   frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 2
                   
                   prepString = "Computer uptime: " & sDays & " days, " & sHours & " hours, " & sMinutes & " minutes and " & sSeconds & " seconds. "
                   cUTString = "Connection uptime: " & cDays & " days, " & cHours & " hours, " & cMinutes & " minutes and " & cSeconds & " seconds."
                   
                   sendPacket &H2, username & Chr$(0) & prepString & cUTString
                Else
                   AddChat vbGray, "-- ", vbYellow, "You must be connected to do that!"
                   frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                   
            End If
    
    Case "smtsw", "sts"
                frmSecret.Show
    
    End Select
End Sub
